﻿@using PageAdmin.Utils;
@{
    CurrentUser user = ViewBag.CurrentUser;
    int defaultSiteId = (int)ViewBag.CurrentSiteId;
    if (StringHelper.IsStr(Request.QueryString["siteId"]))
    {
        defaultSiteId = int.Parse(Request.QueryString["siteId"]);
    }
}
<div class="main">
    <table border=0 cellpadding=0 cellspacing=0 class="tb-head form-inline form-group-sm">
        <tr>
            <td>
                <div class="btn-group btn-group-sm">
                    <input type="hidden" id="tableId" name="tableId" value="@Request.QueryString["tableId"]" class="ui-queryString" />
                    <input type="hidden" id="uid" name="uid" value="@Request.QueryString["uid"]" class="ui-queryString" />
                </div>
            </td>
            <td align="right">
                <div class="controls form-inline">
                   <span>选择站点</span> <select name="siteId" id="siteId" style="width:auto;display:inline" class="form-control ui-queryString ui-queryString-search" data-source="@Html.GetSiteListJsonByUser(user)" data-custom-params="dataSourceFrom:'attr',textField:'Remark'">
                        <option value="0">---选择站点---</option>
                    </select>
                </div>
            </td>
        </tr>
    </table>
    <table border=0 cellpadding=0 cellspacing=0 class="table table-bordered" id="tb_list">
        <thead>
            <tr>
                <td align="center" style="width:50px"><input type="checkbox" title="选择" class="ui-selectInvert hidden" data-custom-params="isReverse:false">选择</td>
                <td align="left"><span>栏目/</span><span class="ui-folder-switch">展开</span></td>
            </tr>
        </thead>
        <tr class="item list-template-item" id="item_{id}" data-parentId="{parentId}" data-id="{id}" data-isFinal="{isFinal}" name="{name}">
            <td align="center" style="width:40px"><input type="checkbox" value="{id}" class="ck checked-item checked-item-isfinal-{isFinal} column-{columnType}"></td>
            <td align="left">{space}<span class="node node_{isFinal}"></span>{name}</td>
        </tr>
    </table>
    <div class="submit-footerbar">
        <label class="control-label"></label>
        <div class="controls">
            <button type="button" class="btn btn-primary btn-sm ui-closeDialog">确定</button>
            <button type="button" class="btn btn-sm btn-default ui-closeDialog">关闭</button>
        </div>
    </div>
</div>

<script type="text/javascript">

    var $siteId = $("#siteId");
    function BindSite()
    {
        var currentSiteId="@defaultSiteId"
        $siteId.SelectBind();
        $siteId.SetValue(currentSiteId);
    }
    BindSite();

    var objName = Request("objname");

    function LoadedInit()
    {
        SetSelectedDisabled();
        $(".checked-item-isfinal-0").attr("disabled", "disabled");
        $(".column-0").attr("disabled", "disabled");
        $(".column-2").attr("disabled", "disabled");
    }

    function LoadData() {
        var ajaxUrl="@Url.ActionUrl("ListData")?_isload=1"
        $("#tb_list").TreeBind({url:ajaxUrl,callBack: "LoadedInit",showFooter:false});
    }
    LoadData();
</script>
<script src="/Js/selectData.js" type="text/javascript"></script>